<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JS 基本语法</title>
</head>

<body>
    <script>
        var x;
        let y = 5;
        const PI = 3.14;
        console.log(x, y, PI);
        let name = "丹恒";
        console.log(name);
        let empty_value = null;
        console.log(empty_value);

        let age = 9;
        if (age >= 18) {
            console.log("你已经成年了");
        } else {
            console.log("你还未成年");
        }

        // let time = 12;
        // if (time < 12) {
        //     alert('上午好');
        // } else if (time < 18) {
        //     alert('下午好');
        // } else {
        //     alert('晚上好');
        // }
        console.log('FOR 循环');
        for (let i = 0; i < 5; i++) {
            console.log(i);
        }
        console.log('WHILE 循环');
        let j = 0;
        while (j < 5) {
            console.log(j);
            j++;
        }
        console.log('循环关键字');
        for (let k = 0; k < 7; k++) {
            if (k === 2) {
                console.log('跳过3');
                continue;
            }
            if (k === 4) {
                console.log('结束循环');
                break;
            }
            console.log(k);
        }
    </script>
</body>

</html>